package cn.bqjr.eily.samples.service.base.impl;

import cn.bqjr.eily.samples.dao.base.DictMapper;
import cn.bqjr.eily.samples.entity.po.Dict;
import cn.bqjr.eily.samples.service.base.IDictService;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author shan.he@bqjr.cn
 * @since 2017-05-11
 */
@Service
public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements IDictService {

    @Override
    public String queryDictVal(String dictType, String key) {
        return selectOne(new EntityWrapper<Dict>()
                .eq(Dict.DICTTYPE, dictType)
                .eq(Dict.DICTKEY, key)
                .orderBy(Dict.SORTNO, true)
        ).getDictValue();
    }
}
